﻿using System;
using System.Text;

namespace YWTSSys.Library
{
    /// <summary>
    /// 公共缓存策略接口
    /// </summary>
    public interface ICacheStrategy
    {
        /// <summary>
        /// 添加指定ID的对象
        /// </summary>
        /// <param name="objId"></param>
        /// <param name="o"></param>
        void Add(string CacheKey, object o);
        /// <summary>
        /// 添加缓存对象,并指定过期时间
        /// </summary>
        /// <param name="CacheKey"></param>
        /// <param name="o"></param>
        /// <param name="timeoutminute"></param>
        void Add(string CacheKey, object o, int timeoutminute);
        /// <summary>
        /// 加入当前对象到缓存中,并使用依赖键(使用system.web.cache时)
        /// </summary>
        /// <param name="CacheKey"></param>
        /// <param name="o"></param>
        /// <param name="dependKey"></param>
        void Add(string CacheKey, object o, string[] dependKey);
        /// <summary>
        /// 移除指定ID的对象
        /// </summary>
        /// <param name="objId"></param>
        void Remove(string CacheKey);

        /// <summary>
        /// 返回指定ID的对象
        /// </summary>
        /// <param name="objId"></param>
        /// <returns></returns>
        object Get(string CacheKey);
        
        /// <summary>
        /// 到期时间
        /// </summary>
        int TimeOut { set; get; }
        /// <summary>
        /// 清除所有的缓存
        /// </summary>
        bool Clear();
    }
}
